package igeekgroup2.ui;

import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import java.util.Map;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.commons.beanutils.BeanUtils;

import igeekgroup2.domain.User;



/**
 * Servlet implementation class PersonalData
 */
@WebServlet("/PersonalData")
public class PersonalData extends HttpServlet {
	private static final long serialVersionUID = 1L;

	protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		Map<String, String[]> map = request.getParameterMap();
		User user =new User();
		//user.setUname("张三");
		request.getContextPath();
		request.getServletPath();
		request.getQueryString();
		request.getRealPath(null);
		try {
			BeanUtils.populate(user, map);
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		System.out.println(user);
		request.setAttribute("user", user);
		user=(User) request.getAttribute("user");
		request.getRequestDispatcher("pd.jsp").forward(request, response);
		String referer=request.getHeader("referer");
		System.out.println(referer);
	}

}
